﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace POS
{
    /// <summary>
    /// Interaction logic for NonAlcoholicDrinks.xaml
    /// </summary>
    public partial class NonAlcoholicDrinks : Window
    {
        double cocaColaPrice = 2.00;
        double frappePrice = 2.50;
        double freshPrice = 3.00;
        double iceTeaPrice = 2.50;
        double lemonadePrice = 3.50;
        double mineralWaterPrice = 1.00;

        public NonAlcoholicDrinks()
        {
            InitializeComponent();
        }

        private void ButtonBackToMainMenu(object sender, RoutedEventArgs e)
        {
            MainWindow mainMenuWindow = new MainWindow();
            mainMenuWindow.Show();
            this.Close();
        }

        private void GoToOrdered(object sender, RoutedEventArgs e)
        {
            Ordered orderedMenu = new Ordered();
            orderedMenu.Show();
            this.Close();
        }

        private void ButtonCocaCola(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxCocaColaCount.Text != "0") && (this.TextBoxCocaColaCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxCocaColaCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Coca Cola", cocaColaPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void Frappe(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxFrappeCount.Text != "0") && (this.TextBoxFrappeCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxFrappeCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Frappe", frappePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonFresh(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxFreshCount.Text != "0") && (this.TextBoxFreshCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxFreshCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Fresh", freshPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonIceTea(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxIceTeaCount.Text != "0") && (this.TextBoxIceTeaCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxIceTeaCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Ice Tea", iceTeaPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonLemonade(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxLemonadeCount.Text != "0") && (this.TextBoxLemonadeCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxLemonadeCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Lemonade", lemonadePrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonMineralWater(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxMineralWaterCount.Text != "0") && (this.TextBoxMineralWaterCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxMineralWaterCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Mineral Water", mineralWaterPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }


        private void RemoveCountCocaColaButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxCocaColaCount.Text == String.Empty)
            {
                this.TextBoxCocaColaCount.Text = "0";
            }

            if (int.Parse(this.TextBoxCocaColaCount.Text) > 0)
            {
                this.TextBoxCocaColaCount.Text = (int.Parse(this.TextBoxCocaColaCount.Text) - 1).ToString();
            }
        }

        private void AddCountCocaColaButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxCocaColaCount.Text == String.Empty)
            {
                this.TextBoxCocaColaCount.Text = "0";
            }
            this.TextBoxCocaColaCount.Text = (int.Parse(this.TextBoxCocaColaCount.Text) + 1).ToString();
        }

        private void RemoveCountFrappeButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxFrappeCount.Text == String.Empty)
            {
                this.TextBoxFrappeCount.Text = "0";
            }

            if (int.Parse(this.TextBoxFrappeCount.Text) > 0)
            {
                this.TextBoxFrappeCount.Text = (int.Parse(this.TextBoxFrappeCount.Text) - 1).ToString();
            }
        }

        private void AddCountFrappeButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxFrappeCount.Text == String.Empty)
            {
                this.TextBoxFrappeCount.Text = "0";
            }
            this.TextBoxFrappeCount.Text = (int.Parse(this.TextBoxFrappeCount.Text) + 1).ToString();
        }

        private void RemoveCountFreshButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxFreshCount.Text == String.Empty)
            {
                this.TextBoxFreshCount.Text = "0";
            }

            if (int.Parse(this.TextBoxFreshCount.Text) > 0)
            {
                this.TextBoxFreshCount.Text = (int.Parse(this.TextBoxFreshCount.Text) - 1).ToString();
            }
        }

        private void AddCountFreshButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxFreshCount.Text == String.Empty)
            {
                this.TextBoxFreshCount.Text = "0";
            }
            this.TextBoxFreshCount.Text = (int.Parse(this.TextBoxFreshCount.Text) + 1).ToString();
        }

        private void RemoveCountIceTeaButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxIceTeaCount.Text == String.Empty)
            {
                this.TextBoxIceTeaCount.Text = "0";
            }

            if (int.Parse(this.TextBoxIceTeaCount.Text) > 0)
            {
                this.TextBoxIceTeaCount.Text = (int.Parse(this.TextBoxIceTeaCount.Text) - 1).ToString();
            }
        }

        private void AddCountIceTeaButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxIceTeaCount.Text == String.Empty)
            {
                this.TextBoxIceTeaCount.Text = "0";
            }
            this.TextBoxIceTeaCount.Text = (int.Parse(this.TextBoxIceTeaCount.Text) + 1).ToString();
        }

        private void RemoveCountLemonadeButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxLemonadeCount.Text == String.Empty)
            {
                this.TextBoxLemonadeCount.Text = "0";
            }

            if (int.Parse(this.TextBoxLemonadeCount.Text) > 0)
            {
                this.TextBoxLemonadeCount.Text = (int.Parse(this.TextBoxLemonadeCount.Text) - 1).ToString();
            }
        }

        private void AddCountLemonadeButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxLemonadeCount.Text == String.Empty)
            {
                this.TextBoxLemonadeCount.Text = "0";
            }
            this.TextBoxLemonadeCount.Text = (int.Parse(this.TextBoxLemonadeCount.Text) + 1).ToString();
        }

        private void RemoveCountMineralWaterButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxMineralWaterCount.Text == String.Empty)
            {
                this.TextBoxMineralWaterCount.Text = "0";
            }

            if (int.Parse(this.TextBoxMineralWaterCount.Text) > 0)
            {
                this.TextBoxMineralWaterCount.Text = (int.Parse(this.TextBoxMineralWaterCount.Text) - 1).ToString();
            }
        }

        private void AddCountMineralWaterButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxMineralWaterCount.Text == String.Empty)
            {
                this.TextBoxMineralWaterCount.Text = "0";
            }
            this.TextBoxMineralWaterCount.Text = (int.Parse(this.TextBoxMineralWaterCount.Text) + 1).ToString();
        }
    }
}
